package com.jingdun.sport.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jingdun.sport.bean.model.OptimalMotionTimeCurve;
import com.jingdun.sport.bean.model.OptimalMotionTimeCurve;
import com.jingdun.sport.dao.OptimalMotionTimeCurveMapper;
import com.jingdun.sport.service.OptimalMotionTimeCurveService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
@Slf4j
@AllArgsConstructor
public class OptimalMotionTimeCurveServiceImpl extends ServiceImpl<OptimalMotionTimeCurveMapper, OptimalMotionTimeCurve> implements OptimalMotionTimeCurveService {

    private OptimalMotionTimeCurveMapper optimalMotionTimeCurveMapper;

    public void addOptimalMotionTimeCurve(OptimalMotionTimeCurve optimalMotionTimeCurve){
        optimalMotionTimeCurveMapper.addOptimalMotionTimeCurve(optimalMotionTimeCurve);
    }

    public OptimalMotionTimeCurve getOptimalMotionTimeCurveDetail(@Param("params") Map<String, Object> m){
        return optimalMotionTimeCurveMapper.getOptimalMotionTimeCurveDetail(m);
    }

    public void updateOptimalMotionTimeCurve(OptimalMotionTimeCurve optimalMotionTimeCurve){
        optimalMotionTimeCurveMapper.updateOptimalMotionTimeCurve(optimalMotionTimeCurve);
    }
    
    public Page<Map<String, Object>> getPaginationOptimalMotionTimeCurve(@Param("params") Map<String, Object> m){
        //新建分页
        Page<Map<String,Object>> page =new Page<Map<String,Object>>((long)m.get("current"), (long)m.get("size"));
        //返回结果
        page.setRecords(this.baseMapper.getPaginationOptimalMotionTimeCurve(page, m));
        return page;
    }

    public List<OptimalMotionTimeCurve> getOptimalMotionTimeCurveList(@Param("params") Map<String, Object> m){
        return optimalMotionTimeCurveMapper.getOptimalMotionTimeCurveList(m);
    }
    
}
